<template>
  <div>
    <ul>
      <li>
        <a href="javascript:;" @click="skip('/contacts/all_contacts')"
          >ALL contacts</a
        >
      </li>
      <li><a href="javascript:;" @click="skip('/contacts/alice')">Alice</a></li>
      <li><a href="javascript:;" @click="skip('/contacts/bob')">Bob</a></li>
    </ul>
    <button
      @click="
        $router.push({
          path: `/contacts/${arr[Math.floor(Math.random() * 2)]}`,
        })
      "
    >
      随机显示
    </button>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: ['all_contacts', 'alice', 'bob'],
      // arr[Math.random()*2]
    }
  },
  methods: {
    skip(path) {
      this.$router.push({
        path,
      })
    },
  },
}
</script>

<style></style>
